#include "TextButton.h"

TextButton::TextButton(GameBase * game, String text, String fontname, Vector2<int> position)
{
	_mText = text;
	_mFontName = fontname;
	_mPosition = position;
}
TextButton::~TextButton()
{
	if(_mTextIcon != NULL)
	{
		delete _mTextIcon;
		_mTextIcon = NULL;
	}
}
Text *TextButton::GetButtonIcon()
{
	return _mTextIcon;
}

void TextButton::Render(RenderWindow *window)
{
	window->draw(*GetButtonIcon());
}
void TextButton::Update()
{

}
bool TextButton::Load(FontManager *FontLibrary)
{
	//Initalize The Text Icon
	_mTextIcon = new Text(_mText, *FontLibrary->GetFont(_mFontName));

	return true;
}

void TextButton::SetText(String newText)
{
	_mTextIcon->setString(newText);
}
void TextButton::SetColor(Color newColor)
{
	_mTextIcon->setColor(newColor);
}